<template>
  <div class="box">
    <div class="area-center bold-size m-t-20">
      <div class="xi title-center">
        <div class="yuan">{{ titleIndex }}</div>
        <div class="zhong">{{ title }}</div>
      </div>
      <div class="coffee m-t-20" v-for="(item, index) in list" :key="index">
        <div class="h4">{{ item.title }}</div>
        <div
          class="small m-t-07"
          v-for="(v, i) in item.coffees"
          :key="i"
          @click="wine(v, i + 1, titleIndex, title)"
        >
          <!-- <img src="../../../assets/black_star.png" alt="" /> -->
        ({{ i + 1 }})
          {{ v.coffeeproTitle }}
        </div>
      </div>

      <div class="richText" v-html="context"></div>
    </div>
  </div>
</template>

<script>
import { coffeeprolist } from "@/api/index";

export default {
  data() {
    return {
      context: "",
      list: "",
      titleIndex: this.$route.query.titleIndex, //标题序号
      title: this.$route.query.title, //标题
    };
  },
  created() {
    coffeeprolist({
      coffeeType: this.$route.query.id,
    }).then((res) => {
      if (res.data.code == 200) {
        this.list = res.data.data[0];
        // this.listone = res.data.data[0][0].coffees;
        // this.typeone = res.data.data[0][0];
        // this.typetwo = res.data.data[0][1];
        // this.listtwo = res.data.data[0][1].coffees;
      }
    });
  },
  methods: {
    //跳转美酒
    wine(item, wine, titleIndex, title) {
      // if(i=="白酒系列"){
      //   this.$router.push({path:"/wincoffee/baijiu",query:{i}})
      // }else if(i=="红酒系列"){
      //   this.$router.push({path:"/wincoffee/redcoffee",query:{i}})
      // }else if(i=="果酒系列"){
      //   this.$router.push({path:"/wincoffee/fruwine",query:{i}})
      // }
      this.$router.push({
        path: "/wincoffee/fruwine",
        query: {
          id: item.coffeeproTitle,
          typeId: item.coffeeproId,
          titleIndex,
          title,
        },
      });
      sessionStorage.setItem("wine", wine);
    },
    //跳转咖啡
    coffee(item, idx) {
      this.$router.push({
        path: "/wincoffee/coffeeproduct",
        query: { id: item.coffeeproTitle, typeId: item.coffeeproId },
      });
      sessionStorage.setItem("idx", idx);
    },
  },
};
</script>

<style scoped>
.box {
  width: 100%;
  display: flex;
  align-items: center;
  flex-direction: column;
}
.center {
  width: 98%;
}

.xi {
  width: 100%;
  margin-top: 0.05rem;
  display: flex;
}
.xi .yuan {
  width: 0.16rem;
  height: 0.16rem;
  margin-left: 0.1rem;
  text-align: center;
  line-height: 0.16rem;
  border-radius: 50%;
  margin-top: 0.05rem;
  border: 1px solid black;
}
.zhong {
  width: 95%;
  height: 100%;
  line-height: 0.3rem;
  padding-left: 5px;
}
/* 美酒区域 */
.wine {
  width: 100%;
}
.h4 {
  width: 90%;
  font-weight: 700;
  padding-left: 0.1rem;
}
/* 小盒子区域 */
.small {
  width: 80%;
  padding-left: 0.1rem;
  display: flex;
  align-items: center;
}
.small img {
  width: 0.2rem;
  margin-right: 0.06rem;
}
/* 咖啡区域 */
.coffee {
  width: 100%;
}
</style>